---
- name: start httpd (provided in the apache role)
  service: name=httpd state=started

- name: ensure packages required for resultsdb_frontend are installed (yum)
  package: name={{ item }} state=present enablerepo={{ extra_enablerepos }}
  when: ansible_distribution_major_version|int < 22
  with_items:
    - resultsdb_frontend
    - mod_wsgi

- name: ensure packages required for resultsdb_frontend are installed (dnf)
  dnf: name={{ item }} state=present enablerepo={{ extra_enablerepos }}
  with_items:
    - resultsdb_frontend
    - mod_wsgi
  when: ansible_distribution_major_version|int > 21 and ansible_cmdline.ostree is not defined

- name: ensure selinux lets httpd talk to the network
  seboolean: name=httpd_can_network_connect persistent=yes state=yes

- name: generate resultsdb_frontend config
  template: src=settings.py.j2 dest=/etc/resultsdb_frontend/settings.py owner=root group=root mode=0644
  notify:
    - reload httpd

- name: generate resultsdb_frontend apache config
  template: src=resultsdb_frontend.conf.j2 dest=/etc/httpd/conf.d/resultsdb_frontend.conf owner=root group=root mode=0644
  notify:
    - reload httpd
